package cc.yugu.yhdw.common.protocol.msg02;

import cc.yugu.yhdw.common.protocol.MsgCode;
import io.netty.buffer.ByteBuf;

public class Msg021000034 extends Msg021 {

    public String boxNum;
    public String no;
    public String volume;
    public int socVolume;
    public int temp1;
    public int temp2;
    public byte chargeState;
    public String protectState;
    public int voltage;
    public int electricity;

    @Override
    public int getMsgCode() {
        return MsgCode.MSG_021000034.getCode();
    }

    @Override
    public void readData(ByteBuf buffer) {
        boxNum = readString(buffer);
        no = readString(buffer);
        volume = readString(buffer);
        socVolume = buffer.readInt();
        temp1 = buffer.readInt();
        temp2 = buffer.readInt();
        chargeState = buffer.readByte();
        char[] str = new StringBuilder(String.format("%0" + 6 + "d", Long.parseLong(Integer.toBinaryString(chargeState)))).reverse().toString().toCharArray();
        chargeState = (byte) str[5];
        protectState = readString(buffer);
        voltage = buffer.readInt();
        electricity = buffer.readInt();
    }
}
